#ifndef __FILEPARSER__H
#define __FILEPARSER__H

#include <vector>
#include <set>
#include <iostream>
#include <fstream>
#include "types/types.h"
#include "../manager/engine/SearchEngine.h"
#include "../catalog/Catalogues.h"
#include <extractor.h>
#include <regex.h>


class FileParser {
    public:
        static std::set<std::string> stopWords;
        
        FileParser(SearchEngine* engine) : engine(engine) {
            initTypes();
            initStopWords();
            initLibExtractor();
        }

        void removeDocuments(std::string path);

        void parse(std::string path);

        ~FileParser();

    private:
        void initTypes();
        void initStopWords();
        void initLibExtractor();
        SearchEngine* engine;
        std::map<std::string,FileType*> fileTypes;
        EXTRACTOR_ExtractorList* plugins;
        regex_t regexSource;
        regex_t regexText;
};

#endif // FileParser_h
